package com.it.myd.service.main.user;

import com.it.myd.bean.main.User;
import com.it.myd.dao.main.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserChangerServiceImpl implements UserChangerService{

    @Autowired
    private UserDao userDao;

    @Override
    public void updateUserProFile(User user) {
        userDao.updateUserProFile(user);
    }
    @Override
    public void updateUserStatus(User user) {
        userDao.updateUserStatus(user);
    }

    public void insertUserInfo(User user){
        userDao.InsertUserInfo(user);
    }
    public void updateUserName(User user){
        userDao.updateUserName(user);
    }

    public void updateUserSex(User user){
        int count = userDao.CheckUserInfo(user);
        if (count>0) {
            userDao.updateUserSex(user);
        }else{
            userDao.InsertUserInfo(user);
        }
    }

    public void updateUserGrjj(User user){
        int count = userDao.CheckUserInfo(user);
        if (count>0) {
            userDao.updateUserGrjj(user);
        }else{
            userDao.InsertUserInfo(user);
        }
    }
}
